/* * Copyright © 2023 https://www.cestc.cn/ All rights reserved. */
package com.ffz.calcitesql.demo;

import com.ffz.calcitesql.sqlparser.BaseSqlParser;
import com.ffz.calcitesql.sqlparser.HiveSqlParser;
import org.apache.calcite.sql.parser.SqlParseException;

/**
 * 请对类注释说明.
 *
 * @author fengfazheng
 * @since 2024/1/15 15:53
 */
public class testDemo {
    public static void main(String[] args) throws SqlParseException {
        String sql3 = "select  dt.d_year \n" +
                "       ,item.i_brand_id brand_id \n" +
                "       ,item.i_brand brand\n" +
                "       ,sum(ss_sales_price) sum_agg\n" +
                " from  date_dim dt \n" +
                "      ,store_sales\n" +
                "      ,item\n" +
                " where dt.d_date_sk = store_sales.ss_sold_date_sk\n" +
                "   and store_sales.ss_item_sk = item.i_item_sk\n" +
                "   and item.i_manufact_id = 816\n" +
                "   and dt.d_moy=11\n" +
                " group by dt.d_year\n" +
                "      ,item.i_brand\n" +
                "      ,item.i_brand_id\n" +
                " order by dt.d_year\n" +
                "         ,sum_agg desc\n" +
                "         ,brand_id\n" +
                " limit 100 offset 200";
        String sql="SELECT sum(x.dd) as xx ,2 from db.a x where id = xx and c = 'zz' ";
        String sql1="SELECT c.d AS R,(select Max(c.ID) as d from ss_sjwkwd as c ) AS F from (select ID as d from " +
                "ss_bzb c)" +
                " as c";
        String sql2="SELECT A.name,B.price FROM  `user` as A, `order` AS B ";
        String sqlsingle="select id from `user` ";
        BaseSqlParser hiveParser=new HiveSqlParser();
        hiveParser.parseSql(sql2);
    }
}
